当前位置:flash课件吧→免费FLASH教程之三(含实例教程)(新页面 新改版 新气象) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
题 目:Flash实现模拟吸管Eyedropper功能动画 c续之前的柔化后觉得BitmapData函数做到了很多之前做不到的效果了,尤其是在制作画板时需要的吸管工具,在这里只要一行函数就能够取得我们要的?色了。。真方便啊
varm=this.createEmptyMovieClip("mc",this.getNextHighestDepth()); varlistener=newMovieClipLoader(); listener.onLoadComplete=function(mc:MovieClip){ mc.onEnterFrame=function(){ varbitmap=newflash.display.BitmapData(this._width,this._height); bitmap.draw(this); this.attachBitmap(bitmap,1,true,true); this.smoothImageLoadComplete(); updateAfterEvent(); } }; listener.loadClip(img,m); }; MovieClip.prototype.pickColor=function(){//取得?片?色 varbitmap=newflash.display.BitmapData(this._width,this._height); bitmap.draw(this); if(bitmap!=undefined){ varmyColor=bitmap.getPixel(this._xmouse,this._ymouse); return"0x" myColor.toString(16).toUpperCase(); } } this.createEmptyMovieClip("mc",0); mc.smoothImageLoad("doggy.jpg"); mc._xscale=mc._yscale=300; this.onMouseMove=function(){ myColor=mc.pickColor();//取得?片的?色函? varcolorTansform=newflash.geom.ColorTransform(); colorTansform.rgb=myColor; colorMc.transform.colorTransform=colorTansform; colorTxt.text=myColor; updateAfterEvent(); }
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|